package com.zzzy.cont.vo.contract.my;

import com.zzzy.common.enums.YesOrNoEnum;
import com.zzzy.cont.common.enums.TradeTypeEnum;
import com.zzzy.framework.common.annotation.RangeValuesCheck;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;

@Data
public class ConUpdateReq {

    @Schema(description = "合同ID")
    @NotNull(message = "合同ID不能为空")
    private Long id;

    @Schema(description = "合同名称")
    @NotBlank(message = "合同名称不能为空")
    @Length(max = 100, message = "合同名称不能超过100个字符")
    private String name;

    @Schema(description = "订单编号")
    @Length(max = 100, message = "订单编号不能超过100个字符")
    private String orderNo;

    @Schema(description = "交易类型：采购、销售")
    @RangeValuesCheck(enumValueRange = TradeTypeEnum.class, message = "交易类型填写错误")
    private String tradeType;

    @Schema(description = "合同类型")
    @Length(max = 100, message = "合同类型不能超过100个字符")
    private String conType;

    @Schema(description = "交易公司名称")
    @NotBlank(message = "交易公司不能为空")
    @Length(max = 255, message = "交易公司不能超过255个字符")
    private String tradeCompany;

    @Schema(description = "合同金额")
    private BigDecimal total;

    @Schema(description = "是否有固定期限(是/否)")
    @RangeValuesCheck(enumValueRange = YesOrNoEnum.class, message = "是否有固定期限填写错误")
    private String hasPeriod;

    @Schema(description = "固定期限开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate beginPeriodTime;

    @Schema(description = "固定期限结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endPeriodTime;

    @Schema(description = "备注")
    @Length(max = 255, message = "备注信息不能超过255个字符")
    private String memo;
}
